from django.shortcuts import render,HttpResponse
from django.views.decorators.csrf import csrf_exempt
from app.grounpdish import grounp_dish
from django.http import JsonResponse


'''
智能组菜爬取列表接口
'''
@csrf_exempt
def grounpdish(request):
    if request.method == "POST":
        work = request.POST.get("work")
        try:
            result = grounp_dish.groupdishes(work)
            data = {
                "errcode": 0,
                "errmsg": "成功",
                "data": {
                    "content": result
                }
            }
        except:
            data = {
                "errcode": 10000,
                "errmsg": "失败"
            }
    return JsonResponse(data=data)
